package com.weixin.paleituo.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.base.BaseRecycleAdapter;
import com.weixin.paleituo.bean.MyHouseBean;
import com.weixin.paleituo.help.RecycleViewHolder;
import com.weixin.paleituo.util.UIUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 我的房产adapter
 *
 * @author fengzhen
 * @version v1.0, 2018/4/13
 */
public class MyHouseRecyclerAdapter extends BaseRecycleAdapter<MyHouseBean> {

    public MyHouseRecyclerAdapter(Context context, List datas) {
        super(context, datas, R.layout.item_my_house);
    }

    @Override
    public RecycleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(UIUtils.inflate(mContext, R.layout.item_my_house, parent, false));
    }

    @Override
    protected void setData(RecycleViewHolder holder, MyHouseBean o, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        viewHolder.mTvNameItemMyHouse.setText(o.getFullname());
        viewHolder.mTvSiteItemMyHouse.setText(o.getHouse());
    }

    static class ViewHolder extends RecycleViewHolder {
        @BindView(R.id.img_item_my_house)
        ImageView mImgItemMyHouse;
        @BindView(R.id.tv_name_item_my_house)
        TextView mTvNameItemMyHouse;
        @BindView(R.id.tv_site_item_my_house)
        TextView mTvSiteItemMyHouse;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
